﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Apex.Security.Cryptography;

namespace Apex.Security.Extensions
{
    public static class CryptoExtensions
    {
        static CryptoExtensions()
        {
            AES.Instance.IV = Encoding.Default.GetBytes("TODO_IV");
            AES.Instance.Key = Encoding.Default.GetBytes("TODO_KEY");
        }

        public static byte[] Encrypt(this byte[] input)
        {
            return AES.Instance.Encrypt(input);
        }
        public static string Encrypt(this byte[] input)
        {
            return AES.Instance.EncryptToString(input);
        }
        public static byte[] Encrypt(this string input)
        {
            return AES.Instance.Encrypt(input);
        }
        public static string Encrypt(this string input)
        {
            return AES.Instance.EncryptToString(input);
        }

        public static byte[] Sign(this byte[] data, byte[] key)
        {
            return RSA.Sign(data, key);
        }
        public static bool VerifySignature(this byte[] data, byte[] key, byte[] sig)
        {
            return RSA.VerifySignature(data, key, sig);
        }
    }
}
